import { Form, Button } from 'antd';
import React, { FC } from 'react';
import { priceFields } from './fields';
import { renderItem } from '@/utils/common';
import { values } from 'lodash';


interface AdvancedFormProps { }

const CreateGoods: FC<AdvancedFormProps> = (props: any) => {
  const { detail, submitting, layout, form, onFinish } = props;

  return (
    <>
      {
        priceFields.map(it => renderItem(it, detail))
      }
      <Form.Item wrapperCol={{ ...layout.wrapperCol, offset: 4 }}>
        <Button
          type="primary"
          loading={submitting}
          onClick={() => {
            form.validateFields().then((values: any) => {
              onFinish(values);
            }).catch((errorInfo: any) => {
              console.log(errorInfo);
            })
          }}
        >
          提交
        </Button>
      </Form.Item>
    </>
  );
};

export default CreateGoods;
